﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	x:Class="CustomControls.MapLocation.MapSearchControl"
	x:Name="UserControl" 
	xmlns:Helpers_Converters="clr-namespace:Helpers.Converters;assembly=Helpers" 
	xmlns:CustomControls_InheritedFrameworkControls="clr-namespace:CustomControls.InheritedFrameworkControls" 
	xmlns:InheritedFrameworkControls="clr-namespace:CustomControls.InheritedFrameworkControls" xmlns:CircularButton="clr-namespace:CustomControls.CircularButton" Width="400" Height="504">
<UserControl.Resources>
	<Style x:Key="ButtonFocusVisual">
			<Setter Property="Control.Template">
				<Setter.Value>
					<ControlTemplate>
						<Rectangle Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="2" SnapsToDevicePixels="true"/>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
			<GradientStop Color="#F3F3F3" Offset="0"/>
			<GradientStop Color="#EBEBEB" Offset="0.5"/>
			<GradientStop Color="#DDDDDD" Offset="0.5"/>
			<GradientStop Color="#CDCDCD" Offset="1"/>
		</LinearGradientBrush>
		<SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070"/>
		<Style x:Key="PrimaryButtonStyle" TargetType="{x:Type Button}">
			<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
			<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
			<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Foreground" Value="White"/>
			<Setter Property="FontWeight" Value="Bold"/>
			<Setter Property="FontSize" Value="14"/>
			<Setter Property="HorizontalContentAlignment" Value="Center"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Padding" Value="1"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Button}">
						<Image Source="NavSetOrigin.png" Stretch="Fill" VerticalAlignment="Center" HorizontalAlignment="Center" Width="60" Height="60"/>
						<ControlTemplate.Triggers>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="DarkGray"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>			
		<Helpers_Converters:SubtractValueConverter x:Key="SubtractValueConverter"/>	
		<LinearGradientBrush x:Key="ButtonNormalBackground1" EndPoint="0,1" StartPoint="0,0">
			<GradientStop Color="#F3F3F3" Offset="0"/>
			<GradientStop Color="#EBEBEB" Offset="0.5"/>
			<GradientStop Color="#DDDDDD" Offset="0.5"/>
			<GradientStop Color="#CDCDCD" Offset="1"/>
		</LinearGradientBrush>
		<SolidColorBrush x:Key="ButtonNormalBorder1" Color="#FF707070"/>
		<Style x:Key="PrimaryButtonStyle1" TargetType="{x:Type Button}">
			<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
			<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
			<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Foreground" Value="White"/>
			<Setter Property="FontWeight" Value="Bold"/>
			<Setter Property="FontSize" Value="14"/>
			<Setter Property="HorizontalContentAlignment" Value="Center"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Padding" Value="1"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Button}">
						<Border x:Name="border" Margin="{TemplateBinding Padding}" Background="{TemplateBinding Background}" BorderBrush="#FF4B4A4A" BorderThickness="1" CornerRadius="5">
							<StackPanel Orientation="Horizontal" Margin="10" HorizontalAlignment="Center">
								<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True" Margin="0" Height="Auto" d:LayoutOverrides="Width"/>
							</StackPanel>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="DarkGray"/>
								<Setter Property="Background" Value="LightGray" TargetName="border"/>
								<Setter Property="BorderBrush" Value="Gray" TargetName="border"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="SlideTouchButtonStyle" TargetType="{x:Type CustomControls_InheritedFrameworkControls:TouchButton}">
			<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
			<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
			<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Foreground" Value="White"/>
			<Setter Property="FontWeight" Value="Bold"/>
			<Setter Property="FontSize" Value="14"/>
			<Setter Property="HorizontalContentAlignment" Value="Center"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Padding" Value="1"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type CustomControls_InheritedFrameworkControls:TouchButton}">
						<Border x:Name="border" Margin="1.333,1,-4.333,1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0,32,32,0">
							<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True" Margin="0" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center"/>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="DarkGray"/>
								<Setter Property="Background" Value="LightGray" TargetName="border"/>
								<Setter Property="BorderBrush" Value="Gray" TargetName="border"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="SetDestinationButtonStyle" TargetType="{x:Type InheritedFrameworkControls:TouchButton}">
			<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
			<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
			<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Foreground" Value="White"/>
			<Setter Property="FontWeight" Value="Bold"/>
			<Setter Property="FontSize" Value="14"/>
			<Setter Property="HorizontalContentAlignment" Value="Center"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Padding" Value="1"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type InheritedFrameworkControls:TouchButton}">
						<Image Height="60" Source="NavSetDest.png" Stretch="Fill" Width="60" VerticalAlignment="Center" HorizontalAlignment="Center"/>
						<ControlTemplate.Triggers>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="DarkGray"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>		
	</UserControl.Resources>
	<!--<UserControl.Effect>
		<DropShadowEffect ShadowDepth="0" BlurRadius="22"/>
	</UserControl.Effect>-->
    <Grid>
    	<DockPanel>
    		<Border x:Name="titleBorder" BorderThickness="1,0,2,3" Width="Auto" DockPanel.Dock="Top" MinHeight="55" VerticalAlignment="Top" Background="#FFCCCCCC" BorderBrush="#FF9D9D9D">
    			<StackPanel Margin="0,0,0,15">
    				<Border BorderBrush="#FF818181" BorderThickness="0,0,0,2" Height="35">
    					<TextBlock TextWrapping="Wrap" FontSize="16" FontWeight="Bold" Text="SEARCH LOCATIONS" Foreground="#FF818181" Height="21.28" HorizontalAlignment="Center"/>
    				</Border>
    				<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
    					<Border Height="35" Width="Auto" Background="White" BorderThickness="2" CornerRadius="20" d:LayoutOverrides="Height" HorizontalAlignment="Center" Margin="62,0,0,0">
    						<Border.BorderBrush>
    							<LinearGradientBrush EndPoint="0.504,1.5" StartPoint="0.504,0.03">
    								<GradientStop Color="Black" Offset="0"/>
    								<GradientStop Color="WhiteSmoke" Offset="0.1967"/>
    							</LinearGradientBrush>
    						</Border.BorderBrush>
    						<StackPanel Margin="20,0" Orientation="Horizontal" d:LayoutOverrides="Height">
    							<Grid Margin="0,0,2,0">
    								<Grid.RowDefinitions>
    									<RowDefinition Height="25*" />
    									<RowDefinition Height="8*" />
    								</Grid.RowDefinitions>
    								<Ellipse HorizontalAlignment="Right" Width="15" Stroke="DarkGray" StrokeThickness="2" Margin="0,5,4.477,3"/>
    								<Path Fill="#FF9F9D9D" Stretch="Fill" Stroke="DarkGray" StrokeThickness="2" Margin="0,0,3,0" Data="M22.512205,21.723696 L25.738911,28.25284" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="6" Height="7" />
    							</Grid>
    							<TextBox x:Name="searchBox" 
    								Height="30" FontSize="17" VerticalContentAlignment="Center"
    								Margin="0,0,3,0" Width="200" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="LightGray"
    								KeyDown="SearchBoxKeyDown" GotFocus="SearchBox_GotFocus" LostFocus="SearchBox_LostFocus"/>
						
    						</StackPanel>
    					</Border>
    				</StackPanel>
    			</StackPanel>
    		</Border>
    		<Border x:Name="border" DockPanel.Dock="Bottom" Margin="0,-0.5,0,0" Width="Auto" BorderThickness="1,0,2,0" BorderBrush="#FF9D9D9D" Background="#FFCCCCCC" >
    			<DockPanel x:Name="dockPanel"
    				Background="#FFCCCCCC" Height="{Binding ActualHeight, ElementName=border, Mode=OneWay}" VerticalAlignment="Top">
    				<InheritedFrameworkControls:IPhoneScrollViewer x:Name="scrollViewer" Margin="20,8" DockPanel.Dock="Top" Height="{Binding ActualHeight, ConverterParameter=80, Converter={StaticResource SubtractValueConverter}, ElementName=dockPanel, Mode=OneWay}" ScrollViewer.VerticalScrollBarVisibility="Hidden" Foreground="{x:Null}">
    					<Border HorizontalAlignment="Stretch" Background="White" BorderThickness="1" BorderBrush="#FF818181">
    						<StackPanel x:Name="container" Orientation="Vertical" CanVerticallyScroll="True" Width="355"/>
    					</Border>
    				</InheritedFrameworkControls:IPhoneScrollViewer>
    				<Border BorderThickness="0,2" BorderBrush="#FF818181" DockPanel.Dock="Bottom" Margin="0,0,0,7" >
    					<DockPanel Margin="21,0" >
    						<TextBlock TextWrapping="Wrap" FontSize="16" FontWeight="Bold" Text="SET AS : " Foreground="#FF818181" Height="21.28" HorizontalAlignment="Center" VerticalAlignment="Center"/>
    						<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="27,0,0,0">
    							<InheritedFrameworkControls:TouchButton x:Name="SourceButton" Content="Set Source" Style="{DynamicResource PrimaryButtonStyle}" Background="#FFE2A31C" HorizontalAlignment="Left" IsEnabled="False" />
    							<InheritedFrameworkControls:TouchButton x:Name="DestinationButton" Content="Set Destination" Style="{DynamicResource SetDestinationButtonStyle}" Background="#FF5AAF22" HorizontalAlignment="Right" IsEnabled="False" Margin="37,0,0,0" />
    						</StackPanel>
    					</DockPanel>
    				</Border>
    			</DockPanel>
    		</Border>
    	</DockPanel>      
    	<InheritedFrameworkControls:TouchButton x:Name="closeButton" Style="{DynamicResource SlideTouchButtonStyle}" HorizontalAlignment="Right" VerticalAlignment="Center" Height="76.333" Margin="0,0,-67.667,0" BorderBrush="#FF949BA6" Foreground="#FF4D4D4D" Width="67.667" FontWeight="Bold" FontSize="24" BorderThickness="0,2,2,2" Background="#FFCCCCCC">
    		  	<CircularButton:CircularToggleButton x:Name="menuButton" HorizontalAlignment="center" VerticalAlignment="Center" CheckedImage="images/menuButtonPressed.png" UncheckedImage="images/menuButton.png"/>
		</InheritedFrameworkControls:TouchButton>
	</Grid>
</UserControl>